using UnityEngine;
using System.Collections;

public class EstampaDireita : MonoBehaviour 
{
	
	
	
	
	// Use this for initialization
	void Start () 
	{
	
	}
	
	// Update is called once per frame
	void Update () 
	
	{
		if(Estampa.DireitaBool == true)
		
		{
			
			foreach (Touch touch in Input.touches) 
			{
			if (touch.phase == TouchPhase.Began) 
			{

            // Construct a ray from the current touch coordinates

        	Ray ray = Camera.main.ScreenPointToRay (touch.position);
            RaycastHit hit = new RaycastHit(); 
            	if (Physics.Raycast(ray,out hit,1000))
					{
						if(hit.collider.gameObject == this.gameObject)  
						{
							Estampa.contador++;
							Debug.Log(Estampa.contador);
						}

					}
				}

			}
			
		}
	
	}
	
	void OnMouseDown()
	{
		if(Estampa.DireitaBool == true)
		{
		Estampa.contador++;
		Debug.Log(Estampa.contador);
		}
	}
}